//
//  HandleViolationCell.swift
//  TrafficViolation
//
//  Created by eaglelive on 2017/5/4.
//  Copyright © 2017年 eaglelive. All rights reserved.
//

import Foundation
import UIKit
class HandleViolationCell:  UITableViewCell{
    var img = UIImageView()
    var carnum = UILabel()
    var remark = UILabel()
    var button1 = UIButton()
    var button2 = UIButton()
    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        self.selectionStyle = UITableViewCellSelectionStyle.none
        self.backgroundColor = tableBgColor
        self.setupMainView()
    }
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}
extension HandleViolationCell{
    
    func setupMainView(){
        // 背景view
        let backgroundView = UIView()
        backgroundView.layer.borderColor = colorFromHex(0xeeeeee).cgColor
        backgroundView.layer.borderWidth = 1
        backgroundView.layer.cornerRadius = 5
        backgroundView.layer.masksToBounds = true
        backgroundView.backgroundColor = UIColor.white
        self.addSubview(backgroundView)
        backgroundView.snp.makeConstraints { (make) in
            make.left.equalTo(self).offset(10)
            make.top.equalTo(self).offset(10)
            make.right.equalTo(self).offset(-10)
            make.bottom.equalTo(self)
        }
        img = UIImageView.init(frame: CGRect(x: 10, y: 20, width: 80, height: 35))
        backgroundView.addSubview(img) //车辆图片 预留位置
        
        carnum = UILabel.init(frame: CGRect(x: 100, y: 20, width: 100, height: 20))
        carnum.textAlignment = .left // 标题
        carnum.font = UIFont.systemFont(ofSize: 16) //设置标题字体大小
        carnum.textColor = UIColor.black
        backgroundView.addSubview(carnum) //车牌号码
        
        remark = UILabel.init(frame: CGRect(x: 100, y: 40, width: 100, height: 30))
        remark.textAlignment = .left // 标题
        remark.font = UIFont.systemFont(ofSize: 12) //设置标题字体大小
        remark.numberOfLines = 0
        remark.textColor = UIColor.lightGray
        backgroundView.addSubview(remark) //备注信息
    }
    func configCellDateWithModel(_ model:CarModel) {
        img.image = UIImage(named: "car_icon")
        carnum.text = model.carnum
        remark.text = model.remark
    }
}
